﻿
using System;
using System.Configuration;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Tools;

namespace Mistral.VisualStudio
{
	/// <summary>
	/// Инсталлятор генератора
	/// </summary>
	class Program
	{
		static void Main( string[] args )
		{
			string registryRoot = ConfigurationManager.AppSettings["registryRoot"];
			string packageName = AppDomain.CurrentDomain.FriendlyName;

			bool register = true;

			if( args != null && args.Length > 0 && args[0].ToLower().Contains( "unregister" ) )
				register = false;

			if( register )
			{
				Console.WriteLine( "Registering package {0}", packageName );
				RegPkg.Register( packageName, registryRoot, RegistrationMethod.CodeBase );	
			}
			else
			{
				Console.WriteLine( "Unregistering package {0}", packageName );
				RegPkg.Unregister( packageName, registryRoot, RegistrationMethod.CodeBase );		
			}
		}
	}
}